package org.example.service.application.impl;

import org.example.domain.entity.SysRole;
import org.example.service.application.SysRoleApplicationService;
import org.example.service.domain.SysRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;

@Service
public class SysRoleApplicationServiceImpl implements SysRoleApplicationService {
    @Resource
    private SysRoleService sysRoleService;

    @Override
    public List<String> selectRoleListByUserId(Long userId) {
        List<SysRole> sysRoleList = sysRoleService.selectRoleByUserId(userId);
        return sysRoleList.stream()
                .map(SysRole::getRoleKey)
                .collect(Collectors.toList());
    }
}
